Quaqua 3.9.5 2007-10-21

ch.randelshofer.quaqua.jaguar
Class QuaquaJaguarFileChooserUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.FileChooserUI
          extended by javax.swing.plaf.basic.BasicFileChooserUI
              extended by ch.randelshofer.quaqua.jaguar.QuaquaJaguarFileChooserUI

public class QuaquaJaguarFileChooserUI
extends javax.swing.plaf.basic.BasicFileChooserUI

A replacement for the AquaFileChooserUI. Provides a column view similar to the one provided with the native Aqua user interface on Mac OS X 10.2 (Jaguar).

Version:
1.7.3 2006-04-23 Labels are now retrieved directly from UIManager.
1.7.2 2005-11-07 Get "Labels" resource bundle from UIManager.
1.7.1 2005-06-05 Moved calls to System.getProperty into QuaquaManager.
1.7 2005-04-22 Tweaked the layout and localized the texts.
1.6.1 2004-12-28 Call clearIconCache() on the IconView, if this method is available.
1.6 2004-10-31 updateSelection had no effect, when a file with a relative path was used. Support for dropping files on the file chooser added. File and directory selection is now handled in a more straightforward way - this may affect code that depends on the values of methods JFileChooser.getSelectedFiles(), JFileChooser.getSelectedFile() while the file chooser is being shown.
1.5.1 2004-10-21 Double clicking the browsers approves the selection. When there is an approvable selection, the approve button is made the default button.
1.5 2004-10-17 Resolve alias files. Do not clear fileName text field, when the user selects a directory. Handle relative path names. Display the real name of a file in the file name text field. Enable the approve button only, when the right kind of file (or directory) is selected. Treat non-traversable directories like files. Fixed a bug where the file name in the file name field was used to determine the approved file altough the field was not visible.
1.4.4 2004-09-11 Replaced all method invocations to method QuaquaManager.getProperty to QuaquaManager.getProperty.
1.4.3 2004-08-28 Set the FileView of the JFileChooser.
1.4.2 2004-07-30 Set the text of the approve button to "Choose", when directory selection is enabled. 1.4.1 2004-07-28 After creating a new folder, make the newly created folder the current directory. Fixed a bug which caused that no new folder was created. DirectoryComboBox was not always updated when a directory was selected.
1.4 2004-06-26 Cell renderer draws different expanded/expanding icon when selected. Renamed from QuaquaFileChooserUI to QuaquaJaguarFileChooserUI.
1.3 2004-05-02 Cell renderer draws visually different selection colors when browser has focus. Each change in the fileNameTextField triggers a change of the selected file in the JFileChooser. When the JFileChooser is no longer shown, we stop autovalidation of the tree model, (instead of invalidating it). Clear the file name text field, when the user selects another directory. The 'New Folder' action created the new folder at the wrong directory. Fixed an NPE in QuaquaJaguarFileChooserUI.DoubleClickListener.mouseClicked().
1.2 2004-03-20 Automatic validation of the tree model can be switched off by setting the system property "Quaqua.FileChooser.autovalidate" to "false". JFileChooser.SAVE_DIALOG mode: When the user selects a file in the browser, we set the file name in the fileNameTextField. This is similar to the behaviour of the FileDialog for Mac OS X 10.3 (Panther). When the file chooser is in JFileChooser.SAVE_DIALOG mode, double clicking a file name does not trigger an 'accept' of the file anymore.
1.1 2004-03-14 When the file chooser is in JFileChooser.SAVE_DIALOG mode, file names are grayed out. The tree model is validated (refreshed) only, when the JFileChooser is showing. The OSXFileSystemView is now created using a factory. There are now two different strategies to invalidate the tree model: lazyInvalidate and invalidate.
1.0.4 2004-02-12 The JBrowser is updating asynchronously. When an update occures between the two clicks of a double click, users may accidently open or save to the wrong file. We ignore know double clicks, if the first click and the second click occured on different files.
1.0.3 2004-02-06 Fixed a bug which prevented the approve button from become enabled, when multiple file selection was turned on. This bug occured on JDK 1.3 only, it did not occur on JDK 1.4 and higher versions.
1.0.1 2003-11-12 Added approveSelectionAction as a listener to the fileNameTextField.
1.0 2003-10-06 Good enough to bear this version number.
0.1 2003-07-24 Created.
Author:
Werner Randelshofer

Nested Class Summary
protected  class QuaquaJaguarFileChooserUI.ApproveSelectionAction
          Responds to an Open or Save request
protected  class QuaquaJaguarFileChooserUI.BrowserSelectionListener
          Selection listener for the list of files and directories.
protected  class QuaquaJaguarFileChooserUI.DirectoryComboBoxAction
          Acts when DirectoryComboBox has changed the selected item.
protected  class QuaquaJaguarFileChooserUI.DirectoryComboBoxModel
          Data model for a directory selection combo-box.
protected  class QuaquaJaguarFileChooserUI.DoubleClickListener
           
protected  class QuaquaJaguarFileChooserUI.FilterComboBoxModel
          Data model for a type-face selection combo-box.
 class QuaquaJaguarFileChooserUI.FilterComboBoxRenderer
          Render different type sizes and styles.
protected  class QuaquaJaguarFileChooserUI.NewFolderAction
          Creates a new folder.
protected  class QuaquaJaguarFileChooserUI.SaveTextDocumentListener
           
protected  class QuaquaJaguarFileChooserUI.SaveTextFocusListener
           
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicFileChooserUI
javax.swing.plaf.basic.BasicFileChooserUI.AcceptAllFileFilter, javax.swing.plaf.basic.BasicFileChooserUI.BasicFileView, javax.swing.plaf.basic.BasicFileChooserUI.CancelSelectionAction, javax.swing.plaf.basic.BasicFileChooserUI.ChangeToParentDirectoryAction, javax.swing.plaf.basic.BasicFileChooserUI.GoHomeAction, javax.swing.plaf.basic.BasicFileChooserUI.SelectionListener, javax.swing.plaf.basic.BasicFileChooserUI.UpdateAction
 
Field Summary
protected  java.lang.String chooseButtonText
           
 
Fields inherited from class javax.swing.plaf.basic.BasicFileChooserUI
cancelButtonMnemonic, cancelButtonText, cancelButtonToolTipText, computerIcon, detailsViewIcon, directoryIcon, directoryOpenButtonMnemonic, directoryOpenButtonText, directoryOpenButtonToolTipText, fileIcon, floppyDriveIcon, hardDriveIcon, helpButtonMnemonic, helpButtonText, helpButtonToolTipText, homeFolderIcon, listViewIcon, newFolderIcon, openButtonMnemonic, openButtonText, openButtonToolTipText, saveButtonMnemonic, saveButtonText, saveButtonToolTipText, updateButtonMnemonic, updateButtonText, updateButtonToolTipText, upFolderIcon
 
Constructor Summary
QuaquaJaguarFileChooserUI(javax.swing.JFileChooser filechooser)
           
 
Method Summary
protected  void addControlButtons()
           
 void clearIconCache()
           
protected  javax.swing.event.AncestorListener createAncestorListener(javax.swing.JFileChooser fc)
          Creates an AncestorListener.
protected  javax.swing.event.TreeSelectionListener createBrowserSelectionListener(javax.swing.JFileChooser fc)
           
protected  QuaquaJaguarFileChooserUI.DirectoryComboBoxModel createDirectoryComboBoxModel(javax.swing.JFileChooser fc)
           
protected  ch.randelshofer.quaqua.jaguar.QuaquaJaguarFileChooserUI.DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(javax.swing.JFileChooser fc)
           
protected  java.awt.event.MouseListener createDoubleClickListener(javax.swing.JFileChooser fc)
           
protected  QuaquaJaguarFileChooserUI.FilterComboBoxModel createFilterComboBoxModel()
           
protected  QuaquaJaguarFileChooserUI.FilterComboBoxRenderer createFilterComboBoxRenderer()
           
 void createModel()
           
 java.beans.PropertyChangeListener createPropertyChangeListener(javax.swing.JFileChooser fc)
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
 void ensureFileIsVisible(javax.swing.JFileChooser fc, java.io.File f)
           
 javax.swing.JPanel getAccessoryPanel()
           
protected  javax.swing.JButton getApproveButton(javax.swing.JFileChooser fc)
           
 java.lang.String getApproveButtonText(javax.swing.JFileChooser fc)
           
 javax.swing.Action getApproveSelectionAction()
           
 java.lang.String getFileName()
           
 javax.swing.filechooser.FileView getFileView(javax.swing.JFileChooser fc)
           
 java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
          Returns the maximum size of the JFileChooser.
 java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
          Returns the minimum size of the JFileChooser.
 javax.swing.Action getNewFolderAction()
           
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          Returns the preferred size of the specified JFileChooser.
 AliasFileSystemTreeModel getTreeModel()
           
 void installComponents(javax.swing.JFileChooser fc)
           
protected  void installListeners(javax.swing.JFileChooser fc)
          Installs listeners.
protected  void installStrings(javax.swing.JFileChooser fc)
           
 void installUI(javax.swing.JComponent c)
           
protected  void removeControlButtons()
           
 void rescanCurrentDirectory(javax.swing.JFileChooser fc)
           
 void setFileName(java.lang.String filename)
           
 void uninstallComponents(javax.swing.JFileChooser fc)
           
protected  void uninstallListeners(javax.swing.JFileChooser fc)
           
 void uninstallUI(javax.swing.JComponent c)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicFileChooserUI
createDoubleClickListener, createListSelectionListener, getAcceptAllFileFilter, getApproveButtonMnemonic, getApproveButtonToolTipText, getCancelSelectionAction, getChangeToParentDirectoryAction, getDialogTitle, getDirectory, getDirectoryName, getFileChooser, getGoHomeAction, getModel, getUpdateAction, installDefaults, installIcons, isDirectorySelected, setDirectory, setDirectoryName, setDirectorySelected, uninstallDefaults, uninstallIcons, uninstallStrings
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, paint, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

chooseButtonText

protected java.lang.String chooseButtonText
Constructor Detail

QuaquaJaguarFileChooserUI

public QuaquaJaguarFileChooserUI(javax.swing.JFileChooser filechooser)
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

installUI

public void installUI(javax.swing.JComponent c)
Overrides:
installUI in class javax.swing.plaf.basic.BasicFileChooserUI

uninstallComponents

public void uninstallComponents(javax.swing.JFileChooser fc)
Overrides:
uninstallComponents in class javax.swing.plaf.basic.BasicFileChooserUI

installComponents

public void installComponents(javax.swing.JFileChooser fc)
Overrides:
installComponents in class javax.swing.plaf.basic.BasicFileChooserUI

getAccessoryPanel

public javax.swing.JPanel getAccessoryPanel()
Overrides:
getAccessoryPanel in class javax.swing.plaf.basic.BasicFileChooserUI

installStrings

protected void installStrings(javax.swing.JFileChooser fc)
Overrides:
installStrings in class javax.swing.plaf.basic.BasicFileChooserUI

installListeners

protected void installListeners(javax.swing.JFileChooser fc)
Installs listeners. We install the same listeners as BasicFileChooserUI plus an AncestorListener.

Overrides:
installListeners in class javax.swing.plaf.basic.BasicFileChooserUI

uninstallListeners

protected void uninstallListeners(javax.swing.JFileChooser fc)
Overrides:
uninstallListeners in class javax.swing.plaf.basic.BasicFileChooserUI

createAncestorListener

protected javax.swing.event.AncestorListener createAncestorListener(javax.swing.JFileChooser fc)
Creates an AncestorListener. The AncestorListener is used to take an action when the JFileChooser becomes showing on screen.


createModel

public void createModel()
Overrides:
createModel in class javax.swing.plaf.basic.BasicFileChooserUI

getTreeModel

public AliasFileSystemTreeModel getTreeModel()

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Overrides:
uninstallUI in class javax.swing.plaf.basic.BasicFileChooserUI

createBrowserSelectionListener

protected javax.swing.event.TreeSelectionListener createBrowserSelectionListener(javax.swing.JFileChooser fc)

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Returns the preferred size of the specified JFileChooser. The preferred size is at least as large, in both height and width, as the preferred size recommended by the file chooser's layout manager.

Overrides:
getPreferredSize in class javax.swing.plaf.ComponentUI
Parameters:
c - a JFileChooser
Returns:
a Dimension specifying the preferred width and height of the file chooser

getMinimumSize

public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
Returns the minimum size of the JFileChooser.

Overrides:
getMinimumSize in class javax.swing.plaf.ComponentUI
Parameters:
c - a JFileChooser
Returns:
a Dimension specifying the minimum width and height of the file chooser

getMaximumSize

public java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
Returns the maximum size of the JFileChooser.

Overrides:
getMaximumSize in class javax.swing.plaf.ComponentUI
Parameters:
c - a JFileChooser
Returns:
a Dimension specifying the maximum width and height of the file chooser

createPropertyChangeListener

public java.beans.PropertyChangeListener createPropertyChangeListener(javax.swing.JFileChooser fc)
Overrides:
createPropertyChangeListener in class javax.swing.plaf.basic.BasicFileChooserUI

removeControlButtons

protected void removeControlButtons()

addControlButtons

protected void addControlButtons()

getFileName

public java.lang.String getFileName()
Overrides:
getFileName in class javax.swing.plaf.basic.BasicFileChooserUI

setFileName

public void setFileName(java.lang.String filename)
Overrides:
setFileName in class javax.swing.plaf.basic.BasicFileChooserUI

createDirectoryComboBoxRenderer

protected ch.randelshofer.quaqua.jaguar.QuaquaJaguarFileChooserUI.DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(javax.swing.JFileChooser fc)

createDirectoryComboBoxModel

protected QuaquaJaguarFileChooserUI.DirectoryComboBoxModel createDirectoryComboBoxModel(javax.swing.JFileChooser fc)

createFilterComboBoxRenderer

protected QuaquaJaguarFileChooserUI.FilterComboBoxRenderer createFilterComboBoxRenderer()

createFilterComboBoxModel

protected QuaquaJaguarFileChooserUI.FilterComboBoxModel createFilterComboBoxModel()

getApproveButton

protected javax.swing.JButton getApproveButton(javax.swing.JFileChooser fc)
Overrides:
getApproveButton in class javax.swing.plaf.basic.BasicFileChooserUI

getApproveSelectionAction

public javax.swing.Action getApproveSelectionAction()
Overrides:
getApproveSelectionAction in class javax.swing.plaf.basic.BasicFileChooserUI

getNewFolderAction

public javax.swing.Action getNewFolderAction()
Overrides:
getNewFolderAction in class javax.swing.plaf.basic.BasicFileChooserUI

ensureFileIsVisible

public void ensureFileIsVisible(javax.swing.JFileChooser fc,
                                java.io.File f)
Overrides:
ensureFileIsVisible in class javax.swing.plaf.basic.BasicFileChooserUI

getApproveButtonText

public java.lang.String getApproveButtonText(javax.swing.JFileChooser fc)
Overrides:
getApproveButtonText in class javax.swing.plaf.basic.BasicFileChooserUI

getFileView

public javax.swing.filechooser.FileView getFileView(javax.swing.JFileChooser fc)
Overrides:
getFileView in class javax.swing.plaf.basic.BasicFileChooserUI

rescanCurrentDirectory

public void rescanCurrentDirectory(javax.swing.JFileChooser fc)
Overrides:
rescanCurrentDirectory in class javax.swing.plaf.basic.BasicFileChooserUI

clearIconCache

public void clearIconCache()
Overrides:
clearIconCache in class javax.swing.plaf.basic.BasicFileChooserUI

createDoubleClickListener

protected java.awt.event.MouseListener createDoubleClickListener(javax.swing.JFileChooser fc)

Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.